//
//  NumberSetViewController.m
//  WE
//
//  Created by apple on 15/11/24.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "NumberSetViewController.h"
#import "Size.h"
#import "SetTableViewCell.h"
#import "ToolUtil.h"
#import "AuthenticateControl.h"
#import "AmendViewController.h"
@interface NumberSetViewController ()<UITableViewDelegate, UITableViewDataSource>

@end

@implementation NumberSetViewController
- (void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBar.hidden = NO;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
     self.view.backgroundColor = [UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"账号设置";
    self.tabBarController.tabBar.hidden = YES;
    UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, WindowWidth, WindowHeight)];
    tableView.delegate = self;
    tableView.dataSource = self;
    [self.view addSubview:tableView];
    tableView.scrollEnabled = NO;
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellStr = @"SetTableViewCell";
    
    SetTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellStr];
    if (!cell) {
        cell = [[SetTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellStr];
    }
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (!indexPath.section && !indexPath.row) {
        cell.arrowImage.image = nil;
        cell.number.text = @"13323829533";
        cell.titleLbl.text = @"账号";
    }else if (!indexPath.section && indexPath.row){
        cell.number.text = nil;
        cell.titleLbl.text = @"实名认证";
    }else if (indexPath.section && !indexPath.row){
        cell.number.text = nil;
        cell.titleLbl.text = @"修改密码";
    }else if(indexPath.section && indexPath.row){
        cell.number.text = @"13323829533";
        cell.titleLbl.text = @"手机绑定";
    }
    
    
    return cell;
    
}


- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    if (!section) {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WindowWidth, 10*Height)];
        view.backgroundColor = [UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0];
        return view;
    }else {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0, WindowWidth, WindowHeight - 170*Height - 64)];
        view.backgroundColor = [UIColor colorWithRed:229/255. green:229/255. blue:229/255. alpha:1.0];
        CGFloat wid = [ToolUtil autoWidth:@"注册时间: 2015-11-24" width:0 height:20 num:10];
        UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake((WindowWidth - wid)/2, 50*Height, wid, 20)];
        timeLabel.text = @"注册时间: 2015-11-24";
        timeLabel.backgroundColor = [UIColor grayColor];
        timeLabel.textColor = [UIColor blackColor];
        timeLabel.layer.cornerRadius = 10;
        timeLabel.layer.masksToBounds = YES;
        timeLabel.font = FONT(10);
        [view addSubview:timeLabel];
        
                              
        
        return view;
    }
    
    
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0 && indexPath.row == 1) {
        [self.navigationController pushViewController:[[AuthenticateControl alloc] init] animated:YES];
    }else if(indexPath.section == 1&&indexPath.row == 0){
        [self.navigationController pushViewController:[[AmendViewController alloc] init] animated:YES];
    }

}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 40*Height;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    if (!section) {
        return 10*Height;
    }else{
        return WindowHeight- 170*Height-64;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
